#include <51func.h>
void func(){
    //return;
    _exit(1);
}
int main(int argc, char *argv[])
{
    pid_t ret = fork();
    if(ret == 0){
        printf("I am child, ret = %d, pid = %d, ppid = %d\n",
               ret,getpid(),getppid());
        //printf("Hello");
        //func();
        //printf("Can you see me ?\n");
        //while(1){
        //    sleep(1);
        //}
        abort();
    }
    else{
        int status;
        printf("I am parent, ret = %d, pid = %d, ppid = %d\n",
               ret,getpid(),getppid());
        wait(&status);
        if(WIFEXITED(status)){
            printf("exit normally, return value = %d\n",WEXITSTATUS(status));
        }
        else if(WIFSIGNALED(status)){
            printf("exit abnormally, return value = %d\n", WTERMSIG(status));
        }
        return 123;
    }
}

